import request from '@/request';
const subscribe = async code => {
    const { data } = await request('getSubscribeListServ', { code });
    // const tmplIds = ['BqUhnBZFyhjig-NTZy0wJ0562oEQJSHhcHPqoeH0yYM'];
    const tmplIds = data?.list[0]?.tid || [];
    return new Promise(resolve => {
        if (uni.requestSubscribeMessage) {
            uni.requestSubscribeMessage({
                tmplIds,
                complete: function () {
                    resolve();
                },
                success(res) {
                    // console.log('subSuccess', res);
                },
                fail(err) {
                    // console.log('subError', err);
                }
            });
        } else {
            resolve();
        }
    });
};

export default subscribe;
